using System;
using System.Web.UI;

namespace Microsoft.ACEEngineering.ErrorHandling
{
	/// <summary>
	/// Summary description for BasePAge.
	/// </summary>
	public class BasePage : System.Web.UI.Page
	{
		public BasePage()
		{
			// Attach the error handler
			this.Error += new EventHandler(BasePage_Error);
		}

		private void BasePage_Error(object sender, EventArgs e)
		{
			// Get the last exception thrown
			Exception ex = Server.GetLastError();
            Server.ClearError();

            string strErr = ex.Message.ToString();

            if(strErr.Substring(0,12) == "A potentiall")
                Response.Redirect(Request.ApplicationPath + "/Errors/MaliciousInput.htm");

            //{"A potentially dangerous Request.Form value was detected from the client"}
            // Set the error page

//			// Throw the error to prevent wrapping
            //throw Server.GetLastError();
		}
	}
}
